{extend name="$_admin_layout"}

{block name="tpl_vars"}
    {eq name="_request_action" value="create"}
        {php}$page_title = '新建选项';{/php}
    {else /}
        {php}$page_title = '修改选项：' . $option_info['title'];{/php}
    {/eq}
{/block}

{block name="main-content"}
    <form id="option_form" class="form form-manager">
        <div class="box box-blue-ebonyclay no-heading">
            <div class="box-body">

                <div class="row">
                    <div class="col-sm-12">
                        {:helper('admin/form')->render_group('name', $option_info['name'], 'text', '名称')}
                        {:helper('admin/form')->render_group('title', $option_info['title'], 'text', '标题')}
                        {:helper('admin/form')->render_group('content', $option_info['content'], 'textarea', '内容')}
                        {:helper('admin/form')->render_submit_and_cancel(request()->url(), $_controller->url('index'))}

                        <script type="text/javascript">
                            $(function(){
                                $('#option_form').bootstrapValidator({
                                    fields: {
                                        name: {
                                            validators: {
                                                notEmpty: {
                                                    message: '名称不能为空',
                                                },
                                            },
                                        },
                                        title: {
                                            validators: {
                                                notEmpty: {
                                                    message: '标题不能为空',
                                                },
                                            },
                                        },
                                        content: {
                                            validators: {
                                                notEmpty: {
                                                    message: '内容不能为空',
                                                },
                                            },
                                        },
                                    },
                                });
                            });
                        </script>
                    </div>
                </div>

            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </form>
{/block}